<%@page import="cn.yi.newsys.pojo.NewsCategory"%>
<%@page import="cn.yi.newsys.service.impl.NewsCategoryServiceImpl"%>
<%@page import="cn.yi.newsys.service.NewsCategoryService"%>
<%@page import="cn.yi.newsys.service.impl.UserServiceImpl"%>
<%@page import="cn.yi.newsys.service.UserService"%>
<%@page import="cn.yi.newsys.pojo.News"%>
<%@page import="cn.yi.newsys.service.impl.NewsServiceImpl"%>
<%@page import="cn.yi.newsys.service.NewsService"%>
<%@page import="cn.yi.newsys.pojo.User"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<!--声明文档兼容模式，表示使用IE浏览器的最新模式-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--设置视口的宽度(值为设备的理想宽度)，页面初始缩放值<理想宽度/可见宽度>-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>新闻中国</title>

<!-- Bootstrap的样式文件-->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" href="images/favicon.ico"
	mce_href="images/favicon.ico" type="image/x-icon">

</head>
<body>
	<!--导航栏-->
	<%@ include file="header.jsp" %>
	<!--轮播图-->
	<div class="container" style="margin-top:-15px">
		<div id="carousel-example-generic" class="carousel slide"
			data-ride="carousel">
			<!-- Indicators -->
			<ol class="carousel-indicators">
				<li data-target="#carousel-example-generic" data-slide-to="0"
					class="active"></li>
				<li data-target="#carousel-example-generic" data-slide-to="1"></li>
				<li data-target="#carousel-example-generic" data-slide-to="2"></li>
				<li data-target="#carousel-example-generic" data-slide-to="3"></li>
			</ol>

			<!-- Wrapper for slides -->
			<div class="carousel-inner" role="listbox">
				<div class="item active">
					<img src="images/banner.png" width="100%" alt="...">
				</div>
				<div class="item">
					<img src="images/banner.png" width="100%" alt="...">
				</div>
				<div class="item">
					<img src="images/banner.png" width="100%" alt="...">
				</div>
				<div class="item">
					<img src="images/banner.png" width="100%" alt="...">
				</div>
			</div>

			<!-- Controls -->
			<a class="left carousel-control" href="#carousel-example-generic"
				role="button" data-slide="prev"> <span
				class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
				<span class="sr-only">Previous</span> </a> <a
				class="right carousel-control" href="#carousel-example-generic"
				role="button" data-slide="next"> <span
				class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
				<span class="sr-only">Next</span> </a>
		</div>
	</div>
	<!--主体内容-->
	<div class="container" style="margin-top: 15px;">
		<div class="row">
			<div class="col-md-3" style="height: 630px;">
				<div class="list-group" style="margin-bottom:2px">
					<a href="#" class="list-group-item active"> 新闻主题 </a> 
					<%
						// 创建 NewsCategoryService 对象
						NewsCategoryService ncs = new NewsCategoryServiceImpl() ;
						// 获得标题集合
						List<NewsCategory> list = ncs.showAllNewsCategory() ;
						pageContext.setAttribute("list1", list) ;				
					%>
					<script type="text/javascript">
						$(function(){
							$.ajax
						})
					</script>
					<!--此处能够直接使用 jstl 是因为 header 中已经添加了指令，而此页面静态包含了 header 页面  -->
					<!--判断集合是否为空  -->
					<c:if test="${list1.size() > 0 }">
						<c:forEach items="${list1 }" var="newsCategory">
							<a href="#" class="list-group-item">${newsCategory.name }<span class="badge">GO</span> </a>
						</c:forEach>
					</c:if>
					<c:if test="${list.size() <= 0}">
						<a href="#" class="list-group-item">国际<span class="badge">GO</span>
					</a> <a href="#" class="list-group-item">天气<span class="badge">GO</span>
					</a> <a href="#" class="list-group-item">科技<span class="badge">GO</span>
					</a> <a href="#" class="list-group-item">娱乐<span class="badge">GO</span>
					</a> <a href="#" class="list-group-item">体育<span class="badge">GO</span>
					</a>
					
					</c:if>					
				</div>
				<div class="list-group">
					<a href="#" class="list-group-item active"> 国内新闻 </a> 
					<%
						// 获取 NewsService 对象
						NewsService ns = new NewsServiceImpl() ;
						// 获得国内新闻集合
						List<News> li = ns.showInlandNews();
						// 将集合放入页面对象中
						pageContext.setAttribute("list2", li) ;
					%>
					<!--判断集合是否为空  -->
					<c:if test="${list2.size() > 0 }">
						<!--循环遍历集合  -->
						<c:forEach items="${list2}" var="news">
							<a href="#" class="list-group-item">${news.nid }<span class="badge">GO</span> </a> 
						</c:forEach>
					</c:if>
					<c:if test="${list2.size() <= 0 }">
						<a href="#" class="list-group-item">呵呵<span class="badge">GO</span> </a>
					</c:if>
					
					
					
					
					
				</div>
			</div>
			
			
			<div class="col-md-6" style="height: 630px;">
				<div class="list-group" style="margin-left: -15px;">
					<a href="#" class="list-group-item active"> 新闻列表 </a> 
					
					
					<%
						List<News> lists = ns.showNews() ;
						// 将新闻集合对象放入页面对象中
						pageContext.setAttribute("list3", lists) ;
					%>
					<!--判断集合是否为空  -->
					<c:if test="${list3.size() > 0 }">
						<!--循环遍历集合  -->
						<c:forEach items="${list3 }" var="n">
							<a target="_blank" href="donews?action=look&id=${n.nid} " class="list-group-item">${n.tittle }<span
						class="badge">GO</span> </a>
						</c:forEach>
					</c:if>
					 <c:if test="${list3.size() <= 0 }">
						 <a target="_blank" href="newsread.jsp" class="list-group-item">王志浩<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">陈亚鹏<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">宋梦宁<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">李占领<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">刘磊<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">吴世远<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">王恒之<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">任杰<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">贾聪聪<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">贾兆琦<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">高思齐<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">崔政德<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">李魏魏<span
							class="badge">GO</span> </a> <a href="#" class="list-group-item">钱义兆<span
							class="badge">GO</span> </a>
					 </c:if>
				</div>

			</div>
			<div class="col-md-3" style="height: 630px;">
				<div class="panel panel-primary" style="margin-left: -15px;">
					<div class="panel-heading">
						<h3 class="panel-title">最新活动</h3>
					</div>
					<div class="panel-body">
						<dl class="text-center">
							<dt>
								<img src="images/new-1.png" />
							</dt>
							<dd>PHP从入门到放弃</dd>
						</dl>
						<dl class="text-center">
							<dt>
								<img src="images/new-2.png" />
							</dt>
							<dd>Java Web从绝望到希望</dd>
						</dl>
						<dl class="text-center">
							<dt>
								<img src="images/new-3.png" />
							</dt>
							<dd>课工场五一回馈</dd>
						</dl>
						<dl class="text-center" style="padding-bottom: 15px">
							<dt>
								<img src="images/new-3.png" />
							</dt>
							<dd>课工场五一回馈</dd>
						</dl>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--通栏广告-->
	<div class="container">
		<img src="images/wy.jpg" width="99.7%">
	</div>
	<!--友情链接和版权信息-->
	<div class="container" style="margin-top: 10px;">
		<div class="row">
			<div class="text-center">
				<ul class="list-inline">
					<li><a href="#">关于我们</a></li>
					<li><a href="#">联系我们</a></li>
					<li><a href="#">招贤纳士</a></li>
					<li><a href="#">法律声明</a></li>
					<li><a href="#">友情链接</a></li>
					<li><a href="#">支付方式</a></li>
					<li><a href="#">配送方式</a></li>
					<li><a href="#">服务声明</a></li>
					<li><a href="#">广告声明</a></li>
				</ul>
			</div>
			<div style="text-align: center;margin-top: 5px;margin-bottom:20px;">
				24小时客户服务热线：010-68988888 常见问题解答 新闻热线：010-627488888<br />
				文明办网文明上网举报电话：010-627488888 举报邮箱：jubao@bj-aptech.com.cn<br />
				Copyright &copy; 2016-2018 朝晞科技,All Right Reserved.<br /> 新闻中心版权所有<br />
				<%
					// 获取网站访问总次数
					Integer count = (Integer) application.getAttribute("count");
					if (count != null) {
						count++;
					} else {
						count = 1;
					}

					application.setAttribute("count", count);
					count = (Integer) application.getAttribute("count");
				%>
				您是本网站的第<%=count%>位访问者,在线人数有${userActive.lineCount }。
			</div>
		</div>
	</div>
	<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
	<script src="js/jquery-1.12.4.js"></script>
	<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
	<script src="js/bootstrap.min.js"></script>
</body>
</html>
